import entity.board;
import DataStructure.node;

public class Assignment1 {

	public static void main(String[] args) {

		board b=txtIO.readFile("input.txt");
		if(b==null){
			System.out.println("FILE WRONG!");
			return;
		}
		
		System.out.println("BFS:");
		BFS bfs=new BFS(b);
		node resultbfs=bfs.search();
		if(resultbfs!=null){
			System.out.println("finalState:");
			System.out.println("A:("+resultbfs.getS().getAx()+","+resultbfs.getS().getAy()+")");
			System.out.println("B:("+resultbfs.getS().getBx()+","+resultbfs.getS().getBy()+")");
			System.out.println("Path:\r\n"+bfs.getPath(resultbfs));
			bfs.writeToTXT("output.txt");
		}
		else
			System.out.println("no solution!");
		
		b=txtIO.readFile("input.txt");
		if(b==null){
			System.out.println("FILE WRONG!");
			return;
		}
		
		System.out.println("UCS:");
		UCS ucs=new UCS(b);
		node resultucs=ucs.search();
		if(resultucs!=null){
			System.out.println("finalState:");
			System.out.println("A:("+resultucs.getS().getAx()+","+resultucs.getS().getAy()+")");
			System.out.println("B:("+resultucs.getS().getBx()+","+resultucs.getS().getBy()+")");
			System.out.println("Path:\r\n"+ucs.getPath(resultucs));
			txtIO.appendFile("output.txt", "---------------------\r\n");
			ucs.appendToTXT("output.txt");
		}
		else
			System.out.println("no solution!");
	}
}
